package edu.cmu.cs.stage3.alice.core.response.visualization.model;

import edu.cmu.cs.stage3.alice.core.Model;
import edu.cmu.cs.stage3.alice.core.visualization.ModelVisualization;

public class SetItem extends ModelVisualizationWithItemAnimation {
	public class RuntimeSetItem extends RuntimeModelVisualizationWithItemAnimation {
		private ModelVisualization m_subject;
		private Model m_value;
		//Rem @Override
		public void prologue( double t ) {
			m_subject = subject.getModelVisualizationValue();
			m_value = item.getModelValue();
			Model prev = m_subject.getItem();
			if( prev != null && prev != m_value ) {
				prev.visualization.set( null );
			}
			super.prologue( t );
		}
		//Rem @Override
		public void update( double t ) {
			super.update( t );
		}
		//Rem @Override
		public void epilogue( double t ) {
			super.epilogue( t );
			m_subject.setItem( m_value );
		}
	}
}
